﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using b7.Models;

namespace b7.Controllers
{
    [Authorize(Roles = "Admin")]//Chi co Admin Moi Dung Duoc Controller nay
    public class AdminController : Controller
    {
        private b7Models db = new b7Models();
        /// <summary>
        ///  Acction su ly phuong thuc get ("khi click vao link Admin")
        /// </summary>
        /// <returns>Nap giao dien web cho client</returns>
        [HttpGet]//phuong thuc get
        public ActionResult Index()
        {
            ////---------------ket noi voi database lay danh sach cac tai khoan-----------//
            //LoginAccountEntities db = new LoginAccountEntities();//ket noi voi database
            List<Member> accounts = db.Members.ToList(); //tuong duong voi cau lenh "Select * from Account"
            ViewBag.data = accounts; //Tao mot bien ViewBag.data de luu du lieu day xuong client
            return View("Index");//nap trang index cho client
        }

    }
}
